Skip to content

⚙️ [Maintenance]: Partial test reruns no longer fail when shared infrastructure has been torn down#594

Merged
Marius Storhaug (MariusStorhaug) merged 12 commits intomainfrom
fix/590-self-healing-test-infra
May 2, 2026
Merged

⚙️ [Maintenance]: Partial test reruns no longer fail when shared infrastructure has been torn down#594
Marius Storhaug (MariusStorhaug) merged 12 commits intomainfrom
fix/590-self-healing-test-infra

Conversation

@MariusStorhaug
Copy link
Copy Markdown
Member

@MariusStorhaug Marius Storhaug (MariusStorhaug) commented May 2, 2026

Re-running individual failed leaf jobs in Process-PSModule.yml now succeeds even after AfterAll-ModuleLocal has deleted the shared test repositories. Each leaf-test BeforeAll block now uses Set-GitHubRepository (which is already idempotent — get-or-create) instead of Get-GitHubRepository followed by a throw on missing, so a partial rerun with Re-run failed jobs no longer requires re-executing every successful sibling job to rebuild infrastructure.

Fixed: Partial reruns of Test-ModuleLocal matrix jobs

Previously, when one or more leaf jobs failed transiently and the workflow proceeded to AfterAll-ModuleLocal, the shared Test-{OS}-{TokenType}-{RunID} repositories were deleted. Clicking Re-run failed jobs then failed every reran leaf job in its BeforeAll, because successful needs (including BeforeAll-ModuleLocal) are not re-executed by GitHub Actions on a partial rerun.

Leaf-test BeforeAll blocks now call Set-GitHubRepository — the module's own idempotent get-or-create function — instead of Get-GitHubRepository with a throw guard. On the happy path the repositories already exist and Set-GitHubRepository returns them unchanged. On a partial rerun where the repositories were torn down, it recreates them transparently and proceeds.

The run-scoped naming (Test-{OS}-{TokenType}-{RunID}) and concurrent-run isolation guarantees from #541 are preserved.

Technical Details

  • tests/BeforeAll.ps1 now provisions repositories through Set-GitHubRepository instead of New-GitHubRepository, making global setup idempotent too (safe to re-run for the same GITHUB_RUN_ID). The pre-clean of stale repositories from previous attempts is preserved.
  • Five test files updated: Actions.Tests.ps1, Environments.Tests.ps1, Releases.Tests.ps1, Secrets.Tests.ps1, Variables.Tests.ps1. Each replaces Get-GitHubRepository + throw-on-missing with a Set-GitHubRepository call using the same parameters the global BeforeAll uses (-AddReadme -License 'mit' -Gitignore 'VisualStudio'). For Secrets/Variables, the org-only -2 / -3 companion repositories follow the same pattern.
  • Repositories.Tests.ps1 is intentionally unchanged — it owns its own per-context lifecycle with a different naming scheme.
  • tests/AfterAll.ps1 is unchanged — the teardown contract is unaffected.
  • No new helper files or abstractions were needed. Set-GitHubRepository already provides the exact idempotent get-or-create semantics required.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 2, 2026

No Significant Changes Detected

This PR does not contain changes to files that would trigger a new release:

Path Description
src/** Module source code
README.md Documentation

Build, test, and publish stages will be skipped for this PR.

If you believe this is incorrect, please verify that your changes are in the correct locations.

@MariusStorhaug Marius Storhaug (MariusStorhaug) changed the title 🪲 [Fix]: Partial test reruns no longer fail because shared infrastructure is missing ⚙️ [Maintenance]: Partial test reruns no longer fail when shared infrastructure has been torn down May 2, 2026
@MariusStorhaug Marius Storhaug (MariusStorhaug) marked this pull request as ready for review May 2, 2026 12:28
@MariusStorhaug Marius Storhaug (MariusStorhaug) requested a review from a team as a code owner May 2, 2026 12:28
Copilot AI review requested due to automatic review settings May 2, 2026 12:28
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 2, 2026

No Significant Changes Detected

This PR does not contain changes to files that would trigger a new release:

Path Description
src/** Module source code
README.md Documentation

Build, test, and publish stages will be skipped for this PR.

If you believe this is incorrect, please verify that your changes are in the correct locations.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 2, 2026

Super-linter summary

Language Validation result
CHECKOV Pass ✅
GITHUB_ACTIONS Pass ✅
GITLEAKS Pass ✅
GIT_MERGE_CONFLICT_MARKERS Pass ✅
MARKDOWN Pass ✅
NATURAL_LANGUAGE Pass ✅
PRE_COMMIT Pass ✅
SPELL_CODESPELL Pass ✅
TRIVY Pass ✅
YAML Pass ✅

All files and directories linted successfully

For more information, see the GitHub Actions workflow run

Powered by Super-linter

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Improves CI robustness for Process-PSModule.yml partial reruns by making leaf test jobs idempotently recreate the shared run-scoped test repositories if AfterAll-ModuleLocal has already torn them down (fixing #590).

Changes:

  • Add tests/Data/SharedTestRepositories.ps1 with idempotent get-or-create helpers for shared test repos (including -2/-3 org extras).
  • Update global tests/BeforeAll.ps1 to provision shared repos via the new helpers (same path as leaf jobs).
  • Update several leaf test files to dot-source the helper and replace “get-or-throw” repo resolution with Initialize-SharedTestRepository (and extras helper where needed).

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/Data/SharedTestRepositories.ps1 New idempotent helpers to get-or-create shared run-scoped repositories (with race recovery).
tests/BeforeAll.ps1 Switches global provisioning to use the new helpers.
tests/Actions.Tests.ps1 Leaf job now initializes shared repo declaratively for rerun self-heal.
tests/Environments.Tests.ps1 Leaf job now initializes shared repo declaratively for rerun self-heal.
tests/Releases.Tests.ps1 Leaf job now initializes shared repo declaratively for rerun self-heal.
tests/Secrets.Tests.ps1 Leaf job now initializes shared repo declaratively; org extras created via helper.
tests/Variables.Tests.ps1 Leaf job now initializes shared repo declaratively; org extras created via helper.

Comment thread tests/BeforeAll.ps1 Outdated
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 2, 2026

No Significant Changes Detected

This PR does not contain changes to files that would trigger a new release:

Path Description
src/** Module source code
README.md Documentation

Build, test, and publish stages will be skipped for this PR.

If you believe this is incorrect, please verify that your changes are in the correct locations.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 2, 2026

Super-linter summary

Language Validation result
CHECKOV Pass ✅
GITHUB_ACTIONS Pass ✅
GITLEAKS Pass ✅
GIT_MERGE_CONFLICT_MARKERS Pass ✅
MARKDOWN Pass ✅
NATURAL_LANGUAGE Pass ✅
PRE_COMMIT Pass ✅
SPELL_CODESPELL Pass ✅
TRIVY Pass ✅
YAML Pass ✅

All files and directories linted successfully

For more information, see the GitHub Actions workflow run

Powered by Super-linter

Copilot AI review requested due to automatic review settings May 2, 2026 13:04
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 2, 2026

No Significant Changes Detected

This PR does not contain changes to files that would trigger a new release:

Path Description
src/** Module source code
README.md Documentation

Build, test, and publish stages will be skipped for this PR.

If you believe this is incorrect, please verify that your changes are in the correct locations.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 2, 2026

Super-linter summary

Language Validation result
CHECKOV Pass ✅
GITHUB_ACTIONS Pass ✅
GITLEAKS Pass ✅
GIT_MERGE_CONFLICT_MARKERS Pass ✅
MARKDOWN Pass ✅
NATURAL_LANGUAGE Pass ✅
PRE_COMMIT Pass ✅
SPELL_CODESPELL Pass ✅
TRIVY Pass ✅
YAML Pass ✅

All files and directories linted successfully

For more information, see the GitHub Actions workflow run

Powered by Super-linter

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 2, 2026

No Significant Changes Detected

This PR does not contain changes to files that would trigger a new release:

Path Description
src/** Module source code
README.md Documentation

Build, test, and publish stages will be skipped for this PR.

If you believe this is incorrect, please verify that your changes are in the correct locations.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 7 comments.

Comment thread tests/BeforeAll.ps1
Comment thread tests/Actions.Tests.ps1
Comment thread tests/Environments.Tests.ps1
Comment thread tests/Releases.Tests.ps1
Comment thread tests/Secrets.Tests.ps1 Outdated
Comment thread tests/Variables.Tests.ps1 Outdated
Comment thread tests/BeforeAll.ps1
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 2, 2026

Super-linter summary

Language Validation result
CHECKOV Pass ✅
GITHUB_ACTIONS Pass ✅
GITLEAKS Pass ✅
GIT_MERGE_CONFLICT_MARKERS Pass ✅
MARKDOWN Pass ✅
NATURAL_LANGUAGE Pass ✅
PRE_COMMIT Pass ✅
SPELL_CODESPELL Pass ✅
TRIVY Pass ✅
YAML Pass ✅

All files and directories linted successfully

For more information, see the GitHub Actions workflow run

Powered by Super-linter

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 2, 2026

No Significant Changes Detected

This PR does not contain changes to files that would trigger a new release:

Path Description
src/** Module source code
README.md Documentation

Build, test, and publish stages will be skipped for this PR.

If you believe this is incorrect, please verify that your changes are in the correct locations.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 2, 2026

Super-linter summary

Language Validation result
CHECKOV Pass ✅
GITHUB_ACTIONS Pass ✅
GITLEAKS Pass ✅
GIT_MERGE_CONFLICT_MARKERS Pass ✅
MARKDOWN Pass ✅
NATURAL_LANGUAGE Pass ✅
PRE_COMMIT Pass ✅
SPELL_CODESPELL Pass ✅
TRIVY Pass ✅
YAML Pass ✅

All files and directories linted successfully

For more information, see the GitHub Actions workflow run

Powered by Super-linter

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 7 comments.

Comment thread tests/Actions.Tests.ps1
Comment thread tests/Environments.Tests.ps1
Comment thread tests/Releases.Tests.ps1
Comment thread tests/Secrets.Tests.ps1 Outdated
Comment thread tests/Variables.Tests.ps1 Outdated
Comment thread .github/instructions/tests.instructions.md Outdated
Comment thread .github/instructions/tests.instructions.md
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 2, 2026

No Significant Changes Detected

This PR does not contain changes to files that would trigger a new release:

Path Description
src/** Module source code
README.md Documentation

Build, test, and publish stages will be skipped for this PR.

If you believe this is incorrect, please verify that your changes are in the correct locations.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 2, 2026

Super-linter summary

Language Validation result
CHECKOV Pass ✅
GITHUB_ACTIONS Pass ✅
GITLEAKS Pass ✅
GIT_MERGE_CONFLICT_MARKERS Pass ✅
MARKDOWN Pass ✅
NATURAL_LANGUAGE Pass ✅
PRE_COMMIT Pass ✅
SPELL_CODESPELL Pass ✅
TRIVY Pass ✅
YAML Pass ✅

All files and directories linted successfully

For more information, see the GitHub Actions workflow run

Powered by Super-linter

Copilot AI review requested due to automatic review settings May 2, 2026 13:34
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 2, 2026

No Significant Changes Detected

This PR does not contain changes to files that would trigger a new release:

Path Description
src/** Module source code
README.md Documentation

Build, test, and publish stages will be skipped for this PR.

If you believe this is incorrect, please verify that your changes are in the correct locations.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 2, 2026

Super-linter summary

Language Validation result
CHECKOV Pass ✅
GITHUB_ACTIONS Pass ✅
GITLEAKS Pass ✅
GIT_MERGE_CONFLICT_MARKERS Pass ✅
MARKDOWN Pass ✅
NATURAL_LANGUAGE Pass ✅
PRE_COMMIT Pass ✅
SPELL_CODESPELL Pass ✅
TRIVY Pass ✅
YAML Pass ✅

All files and directories linted successfully

For more information, see the GitHub Actions workflow run

Powered by Super-linter

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Comment thread tests/TEMPLATE.ps1
Comment thread .github/instructions/tests.instructions.md
…ns docs

TEMPLATE.ps1 and both code snippets in tests.instructions.md were missing
the if-guard for OwnerType values 'repository' and 'enterprise' that all
actual test files already use. Without it the template's switch falls
through silently, returning  without making it explicit, and the
instructions guide readers toward a pattern that omits the guard.
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 2, 2026

No Significant Changes Detected

This PR does not contain changes to files that would trigger a new release:

Path Description
src/** Module source code
README.md Documentation

Build, test, and publish stages will be skipped for this PR.

If you believe this is incorrect, please verify that your changes are in the correct locations.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 2, 2026

Super-linter summary

Language Validation result
CHECKOV Pass ✅
GITHUB_ACTIONS Pass ✅
GITLEAKS Pass ✅
GIT_MERGE_CONFLICT_MARKERS Pass ✅
MARKDOWN Pass ✅
NATURAL_LANGUAGE Pass ✅
PRE_COMMIT Pass ✅
SPELL_CODESPELL Pass ✅
TRIVY Pass ✅
YAML Pass ✅

All files and directories linted successfully

For more information, see the GitHub Actions workflow run

Powered by Super-linter

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Comment thread tests/Secrets.Tests.ps1 Outdated
Comment thread tests/Variables.Tests.ps1 Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Comment thread .github/instructions/tests.instructions.md
…ests; restore tests/README.md as redirect

Secrets.Tests.ps1 and Variables.Tests.ps1 were missing the
if (\ -in ('repository','enterprise')) guard that all other
test files already have. Without it, \/\/\ were left
unset for those auth cases, risking stale-value reuse.

Re-add tests/README.md as a minimal pointer to the canonical
.github/instructions/tests.instructions.md so contributors browsing
tests/ still find the documentation entry point.
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 2, 2026

No Significant Changes Detected

This PR does not contain changes to files that would trigger a new release:

Path Description
src/** Module source code
README.md Documentation

Build, test, and publish stages will be skipped for this PR.

If you believe this is incorrect, please verify that your changes are in the correct locations.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 2, 2026

Super-linter summary

Language Validation result
CHECKOV Pass ✅
GITHUB_ACTIONS Pass ✅
GITLEAKS Pass ✅
GIT_MERGE_CONFLICT_MARKERS Pass ✅
MARKDOWN Pass ✅
NATURAL_LANGUAGE Pass ✅
PRE_COMMIT Pass ✅
SPELL_CODESPELL Pass ✅
TRIVY Pass ✅
YAML Pass ✅

All files and directories linted successfully

For more information, see the GitHub Actions workflow run

Powered by Super-linter

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated no new comments.

@MariusStorhaug Marius Storhaug (MariusStorhaug) merged commit 6bda396 into main May 2, 2026
31 checks passed
@MariusStorhaug Marius Storhaug (MariusStorhaug) deleted the fix/590-self-healing-test-infra branch May 2, 2026 18:55
@github-project-automation github-project-automation Bot moved this from Todo to Done in GitHub PowerShell Module May 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Re-running individual failed test jobs fails because shared infrastructure has been torn down

2 participants